package com.wsseieiei.fireballgame.init;

import net.minecraft.core.Holder;
import net.minecraft.data.worldgen.features.FeatureUtils;
import net.minecraft.data.worldgen.features.OreFeatures;
import net.minecraft.data.worldgen.placement.PlacementUtils;
import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
import net.minecraft.world.level.levelgen.placement.CountPlacement;
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
import net.minecraft.world.level.levelgen.placement.InSquarePlacement;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;

import java.util.List;

public class StruInit {
    public static Holder<ConfiguredFeature<OreConfiguration, ?>> MY_ORE_FEATURE;
    public static Holder<PlacedFeature> MY_ORE;

    public static void registerFeatures() {
        MY_ORE_FEATURE = FeatureUtils.register(
                "fireballgame:firefox_ball_ore_stru",
                // 并基于 Feature.ORE
                Feature.ORE,
                // 这个生成器的操作如下：
                new OreConfiguration(
                        // 将原版的一部分「下界方块」……
                        OreFeatures.NETHER_ORE_REPLACEABLES,
                        // ……替换为模组的火球矿，默认状态，一批最多 10 块。
                        BlockInit.FIREFOX_BALL_ORE.get().defaultBlockState(), 10));
        MY_ORE = PlacementUtils.register(
                "fireballgame:firefox_ball_ore_stru",
                MY_ORE_FEATURE,
                List.of(CountPlacement.of(3),
                        InSquarePlacement.spread(),
                        HeightRangePlacement.uniform(
                                VerticalAnchor.bottom(),
                                VerticalAnchor.top())));
    }
}
